feat(data_table): support custom label and initial column visibility in DataTableColumnToggle - #466
Conversation
…in DataTableColumnToggle Adds a `label:` option (defaults to "Columns") so the trigger text can be localized/customized, and reads `:visible` per column so a column can start hidden (checkbox unchecked). Also adds `checked:` styling to the checkbox. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="gem/test/ruby_ui/data_table_column_toggle_test.rb">
<violation number="1" location="gem/test/ruby_ui/data_table_column_toggle_test.rb:38">
P3: The assertion `assert_equal 1, output.scan("checked class=").length` ties the test to attribute ordering in the rendered HTML. If someone moves `class:` above `checked:` in the component template, this test breaks even though the checked/unchecked behavior is unchanged. Consider a regex that matches `checked` as a standalone boolean attribute regardless of position, e.g. `output.scan(/\bchecked(?:\s|>)/).length` which won't match `checked:` inside class values but will match the boolean `checked` attribute.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
The
Worth having the controller read the initial checkbox states on |
…bleColumnToggle Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… in column toggle test Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bump RubyUI to 1.6.0 (minor: new component + new component options since v1.5.0). - gem/lib/ruby_ui.rb → 1.6.0; regenerate gem/ and docs/ Gemfile.lock - docs home hero badge → headline features (InputOtp, Combobox placement) - rebuild mcp/data/registry.json Highlights since v1.5.0: - New component: InputOtp (#456) - Combobox: configurable popover placement (#480), CheckboxGroup reuse for required ComboboxCheckbox (#479) - DataTable: custom label + initial column visibility in DataTableColumnToggle (#466) - Popover: data-state/data-side, clear closeTimeout on disconnect, close on Escape (#495) - Accordion: no longer clips content that grows after opening (#500, #490) - Toast: toaster state initialized in initialize() so server-rendered toasts don't throw (#499) - Docs: Stimulus controllers symlinked to gem source, no more hand-copied drift (#493)
What & why
DataTableColumnTogglehardcodes the trigger label to"Columns"and always renders every column as initially visible. This adds two small, backward-compatible options:label:(default"Columns") — localize or rename the trigger button.visible:key (defaulttrue) — let a column start hidden (checkbox unchecked) on first render.It also adds
checked:utility classes to the checkbox so the selected state reads clearly in light and dark themes.Usage
Before / after
Notes
labeldefaults to"Columns"andvisibledefaults totrue, so existing call sites are unchanged.mcp/data/registry.jsonrebuilt for the updated component.